<?php
/*********************************************
  Dragonfly CMS, Copyright (c) 2004 by DragonflyCMS Dev. Team.
  http://dragonflycms.org

  Dragonfly is released under the terms and conditions
  of the GNU GPL version 2 or any later version
**********************************************/
if (!defined('ADMIN_MOD_INSTALL')) { exit; }

class Surveys extends Installer_Module
{
	public
		$author,
		$blocks,
		$config,
		$dbtables,
		$description,
		$modname,
		$radmin,
		$userconfig,
		$version,
		$website;

	public function __construct()
	{
		$this->author = 'CPG-Nuke Dev Team';
		$this->blocks = true;
		$this->bypass = false;
		$this->config = array();
		$this->dbtables = array('poll_check', 'poll_data', 'poll_desc', 'pollcomments');
		$this->description = 'Manage Surveys to gain information from your visitors';
		$this->modname = 'Surveys';
		$this->radmin = true;
		$this->test = false;
		$this->userconfig = array();
		$this->version = '1.7.1';
		$this->website = 'dragonflycms.org';
	}

	public function pre_install()
	{
		return true;
	}

	public function post_install()
	{
		return true;
	}

	public function pre_upgrade($prev_version)
	{
		global $db;
		if (version_compare($prev_version, '1.5', '<'))
		{
			foreach (Client::$browserlang as $new => $old) {
				$db->query("UPDATE {$db->TBL->poll_desc} SET planguage='{$new}' WHERE planguage='{$old}'");
			}
		}
		return true;
	}

	public function post_upgrade($prev_version)
	{
		global $db;
		if (version_compare($prev_version, '1.6', '<'))
		{
			$db->query("UPDATE {$db->TBL->poll_desc} SET poll_ptime=time_stamp");
		}
		return true;
	}

	public function pre_uninstall()
	{
		return true;
	}

	public function post_uninstall()
	{
		return true;
	}

}
